package org.yangyang.top100.P538ConvertBSTtoGreaterTree;


import util.tree.TreeNode;

public class Solution {
    private int sum=0;
    public TreeNode convertBST(TreeNode root) {
        //反序中序遍历
        if(root!=null){
            convertBST(root.right);
            sum+=root.val;
            root.val=sum;
            convertBST(root.left);
        }
        return root;
    }
}
